package com.citycloud.ccuap.tc.sync.dto;

import com.citycloud.ccuap.commons.json.JSONData;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class SyncDataDto<T> extends JSONData<T> {
    private static final long serialVersionUID = 1L;

    private String operation;

    private String objectType;

    private Long projectId;

    public SyncDataDto() {
    }

    public SyncDataDto(String objectType, String operation, Long projectId, T data) {
        super(data);
        this.operation = operation;
        this.objectType = objectType;
        this.projectId = projectId;
    }

    public static <T> SyncDataDto<T> of(String objectType, String operation, Long projectId, T data) {
        return new SyncDataDto<T>(objectType, operation, projectId, data);
    }
}
